package com.wiscamp.ninechapters.panels.application.assemblers;


import com.wiscamp.ninechapters.panels.application.command.CreateRoleCommand;
import com.wiscamp.ninechapters.panels.application.command.UpdateRoleCommand;
import com.wiscamp.ninechapters.panels.application.vo.RoleVO;
import com.wiscamp.ninechapters.panels.application.vo.SimpleRoleVO;
import com.wiscamp.ninechapters.panels.domain.entities.Role;
import org.mapstruct.Mapper;
import org.mapstruct.NullValueCheckStrategy;
import org.mapstruct.NullValuePropertyMappingStrategy;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

@Mapper(componentModel = "spring",
        unmappedTargetPolicy = ReportingPolicy.IGNORE,
        unmappedSourcePolicy = ReportingPolicy.IGNORE,
        nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
        nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS,
        imports = {AssemblyLoader.class})
public interface RoleAssembler {
    RoleAssembler Instance = Mappers.getMapper(RoleAssembler.class);

    //@Mapping(target = "menus", expression = "java(AssemblyLoader.loadMenus(entity.getMenuIds()))")
    //@Mapping(target = "permissions", expression = "java(AssemblyLoader.loadPermissions(entity.getPermissionIds()))")
    RoleVO toRoleVO(Role entity);

    SimpleRoleVO toSimpleRoleVO(Role entity);

    Role fromCreateCommand(CreateRoleCommand createCommand);

    Role fromUpdateCommand(UpdateRoleCommand updateCommand);

}
